// this.uploadForm.key = "yzhvideo/wxapp/images" + url.replace(/^http:\/\/tmp|^wxfile:\/\/tmp/, "");
export const upload = url => {
    const token = uni.getStorageSync("token") || "";
    return new Promise((resolve, reject) => {
        uni.uploadFile({
            url: "https://rex-qiu.eicp.top/file/upload", //上传地址
            filePath: url,
            name: "file",
            formData: {},
            header: {
                Authorization: token,
                ["tenant-id"]: 1
            },
            success: res => {
                if (res.statusCode === 200) {
                    const data = JSON.parse(res.data);
                    resolve(data.result.uid);
                } else {
                    uni.showToast({
                        title: "上传失败",
                        icon: "none",
                        duration: 1500
                    });
                    console.log("上传失败 :>> ", res);
                    reject(res);
                }
            },
            fail: err => {
                reject(err);
            }
        });
    });
};
